let babel = require('babel-core');
let types = require('babel-types');
const code = `const sum = (a,b)=>a+b`;
const visitor = {
    ArrowFunctionExpression:{
        enter(path) {
            let node = path.node;
            let expression = node.body;
            let params = node.params;
            //console.log(expression);
            let returnStatement = types.returnStatement(expression);
            let block = types.blockStatement([
                returnStatement
            ]);
            let func = types.functionExpression(null,params, block,false, false);
            path.replaceWith(func);
        }
    }
}
const result = babel.transform(code,{
    plugins:[
        {visitor}
    ]
});
console.log(result.code);